import request from "../../../utils/request";

enum API {
  REQ_TRADEMARK_INFO_URL = "/admin/product/baseTrademark/",
  SAVE_TRADEMARK_URL = "/admin/product/baseTrademark/save",
  UPDATE_TRADEMARK_URL = "/admin/product/baseTrademark/update",
  DELETE_TRADEMARK_URL = "/admin/product/baseTrademark/remove",
}

import { proInfoResponseForm } from "./type";
export const reqProInfo = (page: number, limit: number) => {
  return request.get<any, proInfoResponseForm>(
    API.REQ_TRADEMARK_INFO_URL + `${page}/${limit}`
  );
};

export const reqSaveOrUpdateTrademark = (trademark: any) => {
  if (trademark.id) {
    return request.put<any, any>(API.UPDATE_TRADEMARK_URL, trademark);
  } else {
    return request.post<any, any>(API.SAVE_TRADEMARK_URL, trademark);
  }
};

export const reqDeleteTrademark = (id: number) => {
  return request.delete<any, any>(API.DELETE_TRADEMARK_URL + `/${id}`);
};
